package com.roadjava.rbac.bean.vo;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;

@Data
public abstract class SortableTreeNode<T> {

    /**
     * 主键
     */
    @EqualsAndHashCode.Include
    private Long id;
    /**
     * 父级id,-1:没有父级
     */
    private Long parentId;

    /**
     * 排序,越小排序越靠前
     */
    protected Integer orderNo;

    protected List<T> children = new ArrayList<>();

    public void addChild(T child) {
        this.children.add(child);
    }
}
